# RUN: llc -run-pass=aarch64-expand-pseudo -mtriple=arm64-apple-darwin -o - %s | FileCheck %s

# Check that we preserve renamble when expanding MOVi32imm/MOVi64imm.
#
---
# CHECK-LABEL:  name: test_i32
# CHECK-LABEL:  bb.0:
# CHECK-NEXT:     $sp = frame-setup SUBXri $sp, 32, 0
# CHECK-NEXT:     renamable $w8 = MOVZWi 4, 0
# CHECK-NEXT:     STRWui killed renamable $w8, $sp, 0
# CHECK-NEXT:     $w8 = MOVZWi 45926, 0
# CHECK-NEXT:     $w8 = MOVKWi $w8, 102, 16
# CHECK-NEXT:     STRWui killed renamable $w8, $sp, 1
# CHECK-NEXT:     renamable $w8 = MOVZWi 10319, 0
# CHECK-NEXT:     renamable $w8 = MOVKWi $w8, 2942, 16
# CHECK-NEXT:     STRWui killed renamable $w8, $sp, 2
# CHECK-NEXT:     renamable $w8 = MOVZWi 30600, 0
# CHECK-NEXT:     renamable $w8 = MOVKWi $w8, 21862, 16
# CHECK-NEXT:     STRWui killed renamable $w8, $sp, 3
# CHECK-NEXT:     $sp = frame-destroy ADDXri $sp, 32, 0
# CHECK-NEXT:     RET undef $lr
#
name:           test_i32
alignment:       8
tracksRegLiveness: true
frameInfo:
  stackSize:       32
  maxAlignment:    4
  maxCallFrameSize: 0
  localFrameSize:  24
stack:
  - { id: 0, offset: -4, size: 4, alignment: 4, local-offset: -4 }
  - { id: 1, offset: -8, size: 4, alignment: 4, local-offset: -8 }
  - { id: 2, offset: -12, size: 4, alignment: 4, local-offset: -12 }
  - { id: 3, offset: -16, size: 4, alignment: 4, local-offset: -16 }
machineFunctionInfo: {}
body:             |
  bb.0:
    $sp = frame-setup SUBXri $sp, 32, 0
    renamable $w8 = MOVi32imm 4
    STRWui killed renamable $w8, $sp, 0
    $w8 = MOVi32imm 6730598
    STRWui killed renamable $w8, $sp, 1
    renamable $w8 = MOVi32imm 192817231
    STRWui killed renamable $w8, $sp, 2
    renamable $w8 = MOVi32imm 1234605616436508552
    STRWui killed renamable $w8, $sp, 3
    $sp = frame-destroy ADDXri $sp, 32, 0
    RET_ReallyLR

...
---
# CHECK-LABEL:  name: test_i64
# CHECK-LABEL:  bb.0:
# CHECK-NEXT:     $sp = frame-setup SUBXri $sp, 32, 0
# CHECK-NEXT:     renamable $x8 = MOVZXi 4, 0
# CHECK-NEXT:     STRXui killed renamable $x8, $sp, 0
# CHECK-NEXT:     $x8 = MOVZXi 45926, 0
# CHECK-NEXT:     $x8 = MOVKXi $x8, 102, 16
# CHECK-NEXT:     STRXui killed renamable $x8, $sp, 1
# CHECK-NEXT:     renamable $x8 = MOVNXi 25166, 0
# CHECK-NEXT:     renamable $x8 = MOVKXi $x8, 55686, 16
# CHECK-NEXT:     renamable $x8 = MOVKXi $x8, 63160, 32
# CHECK-NEXT:     STRXui killed renamable $x8, $sp, 2
# CHECK-NEXT:     renamable $x8 = MOVZXi 30600, 0
# CHECK-NEXT:     renamable $x8 = MOVKXi $x8, 21862, 16
# CHECK-NEXT:     renamable $x8 = MOVKXi $x8, 13124, 32
# CHECK-NEXT:     renamable $x8 = MOVKXi $x8, 4386, 48
# CHECK-NEXT:     STRXui killed renamable $x8, $sp, 3
# CHECK-NEXT:     $sp = frame-destroy ADDXri $sp, 32, 0
# CHECK-NEXT:     RET undef $lr
#
name:           test_i64
alignment:       8
tracksRegLiveness: true
frameInfo:
  stackSize:       32
  maxAlignment:    4
  maxCallFrameSize: 0
  localFrameSize:  32
stack:
  - { id: 0, offset: -8, size: 8, alignment: 4, local-offset: -8 }
  - { id: 1, offset: -16, size: 8, alignment: 4, local-offset: -16 }
  - { id: 2, offset: -24, size: 8, alignment: 4, local-offset: -24}
  - { id: 3, offset: -32, size: 8, alignment: 4, local-offset: -32 }
machineFunctionInfo: {}
body:             |
  bb.0:
    $sp = frame-setup SUBXri $sp, 32, 0
    renamable $x8 = MOVi64imm 4
    STRXui killed renamable $x8, $sp, 0
    $x8 = MOVi64imm 6730598
    STRXui killed renamable $x8, $sp, 1
    renamable $x8 = MOVi64imm -10201192817231
    STRXui killed renamable $x8, $sp, 2
    renamable $x8 = MOVi64imm 1234605616436508552
    STRXui killed renamable $x8, $sp, 3
    $sp = frame-destroy ADDXri $sp, 32, 0
    RET_ReallyLR

...
---
